<?php  if( !defined("IN_IA") )
{
    exit( "Access Denied" );
}
require(EWEI_SHOPV2_PLUGIN . "dividend/core/dividend_page_web.php");
class Member_EweiShopV2Page extends DividendWebPage
{
    public function main()
    {
        header("location: " . webUrl("member/list"));
    }

    public function performance()
    {
        global $_W;
        global $_GPC;
        $model = m('slwxkf');
        $member = $model->getInfo('member',array('uniacid' => $_W['uniacid'],'id' => $_GPC['id']));
        $list = $model->annualQuarter($member['openid'],$_W['uniacid']);
        if (!empty($list)){
            $firstyear = $list[0][0][0]['y'];
        }
        include($this->template());
    }

    public function give()
    {
        global $_W;
        global $_GPC;
        $model = m('slwxkf');
        if (!empty($_GPC['price'])){
            $result = $model->insert('price_jidu',array('uniacid' => $_W['uniacid'],'time' => $_GPC['time'],'price' => $_GPC['price'],'createtime' => time(),'openid' => $_GPC['openid']));
            if ($result){
                m('member')->setCredit($_GPC['openid'], 'credit2', $_GPC['price'], array(0, $_GPC['message'].'季度 自购返利' . $_GPC['price']));
            }
        }
        header("location: " . webUrl("dividend.member.performance",array('id' => $_GPC['id'])));
    }
}
?>